Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only append init segment on change #1128

Merged
merged 6 commits into from
May 17, 2021

Conversation

brandonocasey
Copy link
Contributor

Description

Only append init segments on change.

@codecov
Copy link

codecov bot commented May 11, 2021

Codecov Report

Merging #1128 (f7aab4d) into main (740d2ee) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1128   +/-   ##
=======================================
  Coverage   86.19%   86.20%           
=======================================
  Files          39       39           
  Lines        9281     9284    +3     
  Branches     2126     2126           
=======================================
+ Hits         8000     8003    +3     
  Misses       1281     1281           
Impacted Files Coverage Δ
src/segment-loader.js 95.81% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 740d2ee...f7aab4d. Read the comment docs.

@@ -3142,6 +3142,7 @@ QUnit.module('SegmentLoader', function(hooks) {
appends[1].initSegment,
'appended a different init segment'
);
loader.appendInitSegment_.audio = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests were relying on re-appending init segments, which shoudn't happen here, but I think these tests are still valuable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth adding those details to the comment (here and below) to ensure we don't forget why we force it in the future.

Comment on lines 2099 to 2101
// we should only be appending the next init segment if we detect a change, or if
// the segment has a map
this.appendInitSegment_[type] = map ? true : false;
this.appendInitSegment_[type] = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should update the comment to something like: "disable future init segments appends for this type (until a change is necessary)"

Comment on lines +2375 to +2378
this.appendInitSegment_ = {
video: true,
audio: true
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be dependent on the type that this loader is handling?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it should because if we get an audio or video init segment on this segment loader, we should re-append it. It won't likely happen for a video only loader or an audio only loader, but at this point we won't actually know what type of content we are requesting, as we get that in trackinfo.

@@ -3142,6 +3142,7 @@ QUnit.module('SegmentLoader', function(hooks) {
appends[1].initSegment,
'appended a different init segment'
);
loader.appendInitSegment_.audio = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth adding those details to the comment (here and below) to ensure we don't forget why we force it in the future.

src/segment-loader.js Outdated Show resolved Hide resolved
Co-authored-by: Garrett Singer <[email protected]>
@brandonocasey brandonocasey merged commit a4af004 into main May 17, 2021
@brandonocasey brandonocasey deleted the fix/only-append-changed-init branch May 17, 2021 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants